<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>
<%@ include file="/WEB-INF/views/templete/hplus/head.jsp" %>
<html>
<head>
<title>反馈建议管理</title>
<meta name="decorator" content="default" />
<script type="text/javascript">
	$(document).ready(
			function() {
				//$("#name").focus();
				$("#inputForm")
						.validate(
								{
									submitHandler : function(form) {
										loading('正在提交，请稍等...');
										form.submit();
									},
									errorContainer : "#messageBox",
									errorPlacement : function(error, element) {
										$("#messageBox").text("输入有误，请先更正。");
										if (element.is(":checkbox")
												|| element.is(":radio")
												|| element.parent().is(
														".input-append")) {
											error.appendTo(element.parent()
													.parent());
										} else {
											error.insertAfter(element);
										}
									}
								});
				loadStatus();
			});

	function loadStatus() {
		var state = '${feedback.state}';
		switch (state) {
		case 'unread':
			loadState('未读');
			break;
		case 'replied':
			loadState('已读');
			break;
		}
	}

	function loadState(state) {
		$('#s2id_state').find('a > span.select2-chosen').text(state);
	}
</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li><a href="${ctx}/task/feedback/">反馈建议列表</a></li>
		<li class="active"><a
			href="${ctx}/task/feedback/form?id=${feedback.id}">反馈建议<shiro:hasPermission
					name="task:feedback:edit">${not empty feedback.id?'修改':'添加'}</shiro:hasPermission>
				<shiro:lacksPermission name="task:feedback:edit">查看</shiro:lacksPermission></a></li>
	</ul>
	<br />
	<form:form id="inputForm" modelAttribute="feedback"
		action="${ctx}/task/feedback/save" method="post"
		class="form-horizontal">
		<form:hidden path="id" />
		<sys:message content="${message}" />
		<div class="control-group">
			<label class="control-label">反馈类型：</label>
			<div class="controls">
				<form:input path="type" htmlEscape="false"
					class="input-xlarge required" />
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">反馈内容：</label>
			<div class="controls">
				<form:textarea path="content" htmlEscape="false" rows="4"
					maxlength="1000" class="input-xxlarge required" />
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">回复状态：</label>
			<div class="controls">
				<form:select path="state" htmlEscape="false"
					class="input-xlarge required">
					<form:option value="replied">已读</form:option>
					<form:option value="unread">未读</form:option>
				</form:select>
				<%-- <form:input path="state" htmlEscape="false"
					class="input-xlarge required" /> --%>
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="control-group">
			<label class="control-label">机构ID：</label>
			<div class="controls">
				<form:input path="institutionId" htmlEscape="false" maxlength="20"
					class="input-xlarge required digits" />
				<span class="help-inline"><font color="red">*</font> </span>
			</div>
		</div>
		<div class="form-actions">
				<input id="btnSubmit" class="btn btn-primary" type="submit"
					value="保 存" />&nbsp;
			<input id="btnCancel" class="btn" type="button" value="返 回"
				onclick="history.go(-1)" />
		</div>
	</form:form>
</body>
</html>